UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CszskIO+fJnn8l+gwYtrell7rBeAc/j7t9h+LSIykyA=' 
WHERE 
  key_id = 'b00107ba88b39230b6b938d02dc38bf182b373df0860d110b17a91b3b79dd76f' 
  AND (
    token = 'CszskIO+fJnn8l+gwYtrell7rBeAc/j7t9h+LSIykyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029