UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm5unAnf5NVGgFVSi8cpnMjicDyLljt+1UyUTbnODHGs='
WHERE
key_id = '349ba0f47420f744cb36ec59809a04d87132786450b46ff40334b7c72ab0c562'
AND (
token = 'm5unAnf5NVGgFVSi8cpnMjicDyLljt+1UyUTbnODHGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)