UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MPOQvKfFTS66mwriXOBnM2CvGU3ipdrjxjaeqTiZ6GQ=' 
WHERE 
  key_id = '6878b2a3ca25a9b80edae41b7d4c2ce3a4e13a34c8886400e34107a131dea111' 
  AND (
    token = 'MPOQvKfFTS66mwriXOBnM2CvGU3ipdrjxjaeqTiZ6GQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045