UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I99H1MtCeaJQRj4+QSBIiReOwFUQyQs6FhENXuSFag8=' 
WHERE 
  key_id = '125544a468b5488bdf02d81e75dd2f0d6d9dceeb450e1d72180c3f0a16f71521' 
  AND (
    token = 'I99H1MtCeaJQRj4+QSBIiReOwFUQyQs6FhENXuSFag8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031