UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mAzOJKWMRo3tROQDoOJOvagubYDrH6zSVFlNP6jhfWE=' 
WHERE 
  key_id = '5e49f7671a42c034be474691d36f4e85f02fc08096f1dfddcfe90c33f25939a9' 
  AND (
    token = 'mAzOJKWMRo3tROQDoOJOvagubYDrH6zSVFlNP6jhfWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038