UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KYmNLKV65Tx0189N4rkhUt8vuZikOxkBNXef/TSaiSs='
WHERE
key_id = '651dd50975090305a63d82007135cf774a3fa2878367faaa30287cd4c8bcd7de'
AND (
token = 'KYmNLKV65Tx0189N4rkhUt8vuZikOxkBNXef/TSaiSs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)