UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sxzyK+ol4+hzBmn2xZh2Z5RutAmyrdtr3IYRHjcSc2A=' 
WHERE 
  key_id = '27af672552b6ecc372e265da3612823875410e6136e6919ff81829b79553be0f' 
  AND (
    token = 'sxzyK+ol4+hzBmn2xZh2Z5RutAmyrdtr3IYRHjcSc2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045