UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZd8aiEwXQQRJYBBfhfWFMLXeJeW3tv33HTTERPbi30='
WHERE
key_id = '2facd711d21cab5ade5159bc5846680ee5035ecfbcd5018c0ce6910d750d88cb'
AND (
token = 'qZd8aiEwXQQRJYBBfhfWFMLXeJeW3tv33HTTERPbi30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)