UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+yELq7nYRv6K8h3bQTy0dcIEaQNfwTnWvhk/zstnnnA=' 
WHERE 
  key_id = 'dad39524195a1ee9e3b8ea5d4f56ee7705984d498158d7df532b10897b444453' 
  AND (
    token = '+yELq7nYRv6K8h3bQTy0dcIEaQNfwTnWvhk/zstnnnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040