UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4xPpU9W0Si2qe7sGhadySu4jJEVFfrFcL4asi/v3p+U=' 
WHERE 
  key_id = '0d9c39f84094d2dffa18e4026032d40cf808d9a1c8be38fec3071953c2bb0027' 
  AND (
    token = '4xPpU9W0Si2qe7sGhadySu4jJEVFfrFcL4asi/v3p+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027