UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bqDrzmCgfofCvC+GfLCuSO+0cVDelxFLs2/Arw8Qgko=' 
WHERE 
  key_id = '3ba7db84028a8e557c7c1a6fce7c610d02847dd1101965759d20babc2ead7dbd' 
  AND (
    token = 'bqDrzmCgfofCvC+GfLCuSO+0cVDelxFLs2/Arw8Qgko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046