UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'whFa1i0EnmBRJMSUsoc7mSbnIExxY1IzRTAmUPp1sIk=' 
WHERE 
  key_id = '4f908ead5e9a7a4df66375ce41e3c8796d6c6619527e476900d64f1edbf8f6f1' 
  AND (
    token = 'whFa1i0EnmBRJMSUsoc7mSbnIExxY1IzRTAmUPp1sIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020