UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XkyhqSK+bieeJ4g1wbM3qkANOS1gBY1Nt2nFVzE21gE='
WHERE
key_id = '1197b545478c407e5795575b4ddc29ff462fb87c1c3d9f35bd794170043eaedc'
AND (
token = 'XkyhqSK+bieeJ4g1wbM3qkANOS1gBY1Nt2nFVzE21gE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)