UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RWlcLYdfX81NJe6Y7nej8rYrZaBUKfXsSwlPJwNHTGE='
WHERE
key_id = '1385263f6b9e6130bff1f1468475e67528428fe38848b29a689be01c04937571'
AND (
token = 'RWlcLYdfX81NJe6Y7nej8rYrZaBUKfXsSwlPJwNHTGE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)