UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGd938pzVLT9LCbKmlWjSdhmtGkUvdpWETlzh6Opo5Q=' 
WHERE 
  key_id = 'd3e05dfc23b46a936e7179995c6a990b42a96f45c9d889b1b59b5c07110ded22' 
  AND (
    token = 'WGd938pzVLT9LCbKmlWjSdhmtGkUvdpWETlzh6Opo5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044