UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r6wlyPZ3EZfwlqI+4dos9/fU/M7aUihqsLEYhXbMn+s='
WHERE
key_id = '999f86591965c8820d9496654e59c4e40e6fef4ad03abac455520d4493586e48'
AND (
token = 'r6wlyPZ3EZfwlqI+4dos9/fU/M7aUihqsLEYhXbMn+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)