UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pEnCs8U9uvK5rGF+HWTAfqvOiN1S5thi5HI69tsV/Es=' 
WHERE 
  key_id = 'd2dfb0db9e15973ecc413bc7acd36b989be00b1eb388456055f062e903439da8' 
  AND (
    token = 'pEnCs8U9uvK5rGF+HWTAfqvOiN1S5thi5HI69tsV/Es=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047