UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cWCNGdnFhl29p4tzfvPSHYGh/nupD69fbM7lt0Fia5Q=' 
WHERE 
  key_id = '8c40cf717ade9fd3f473492027069dc91ab1a6696e55c1b13a0c959cdbdadff3' 
  AND (
    token = 'cWCNGdnFhl29p4tzfvPSHYGh/nupD69fbM7lt0Fia5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082