UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P4DrmzDSyMF7v9J61EXtsDEvUIiNxLX213LlzATWL4U=' 
WHERE 
  key_id = '522d6b0a5bd47d09430c0e0dbc85f7089686824a7e694a862fe0ff2c3b7ae8f7' 
  AND (
    token = 'P4DrmzDSyMF7v9J61EXtsDEvUIiNxLX213LlzATWL4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047