UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f871vS1nAqPPASSvPtBtAkp+gb7tEzKMKDE6W3KUeTM=' 
WHERE 
  key_id = 'f41de93a4b6e4a20111a246199c3ac42ea27e4b018edcc214e9803b30d2e7480' 
  AND (
    token = 'f871vS1nAqPPASSvPtBtAkp+gb7tEzKMKDE6W3KUeTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020