UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nd1EL/wVqsay8aKO6VsW/kPcw96qeebcgWY+KP+VbPo=' 
WHERE 
  key_id = '0dcb0bdce2f079f384875130870caf3e2b30cd4ceaf6d8041e7d44a98f455a15' 
  AND (
    token = 'Nd1EL/wVqsay8aKO6VsW/kPcw96qeebcgWY+KP+VbPo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048