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