UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd1TTzJ0TVORt7zY60C/HTCTrRpFg/uafUhV+Z/avmm0=' 
WHERE 
  key_id = '3bb176107c0437995515fbae2a7b369a82e92af72bfaae129ea2fef6d3f41b21' 
  AND (
    token = 'd1TTzJ0TVORt7zY60C/HTCTrRpFg/uafUhV+Z/avmm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022