UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lyONDC493dZ/DlOpl36iXwWlArEVn99ZLvCU77s3B/0=' 
WHERE 
  key_id = 'a9d268d8d67ba9c27e5798e7974a3fd21f59e13af3f1c7ed9d87948da61d193d' 
  AND (
    token = 'lyONDC493dZ/DlOpl36iXwWlArEVn99ZLvCU77s3B/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036