UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P6mgw/6+WL5keIrTfJdpfzh91JiI1MBQ/RYQ6ZXbIQA=' 
WHERE 
  key_id = '0713078cc4b37d7595e09e15149bdffa357e6a5e53487b351c06e2a68720b7d4' 
  AND (
    token = 'P6mgw/6+WL5keIrTfJdpfzh91JiI1MBQ/RYQ6ZXbIQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030