UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HARDC55/0+NhmtVEGqAq07SSYE71zYgKaqGTuRSOxf4=' 
WHERE 
  key_id = '6b3d0b882d33bd80c4a797777be57eb4dd1637de356223bdcf127b6adb763a27' 
  AND (
    token = 'HARDC55/0+NhmtVEGqAq07SSYE71zYgKaqGTuRSOxf4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044