UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zL2kTHgs/5b8Z+ogTv82WqYtv8WllNJn6s4+20HcqPo='
WHERE
key_id = 'f5081e57730153916674bef71143b8fe65cf10c76b94892f9ba520ee4f54c819'
AND (
token = 'zL2kTHgs/5b8Z+ogTv82WqYtv8WllNJn6s4+20HcqPo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)