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