UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zmDKTCkr5w35bhgXeie9l6SV94iYX2gzgtvJWsdt/hA='
WHERE
key_id = '97c4ecda58431c74819eba8344e90621a7768d20760a7b3f99fc6d818122f10e'
AND (
token = 'zmDKTCkr5w35bhgXeie9l6SV94iYX2gzgtvJWsdt/hA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)