UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XKV6hXsJz0F2YQEdJ6XZSzseVFEfQo4qikc688y3PR8='
WHERE
key_id = '79dd4ab0b728a633af3a7f93b3695b37de7f77daad1f074b6f579bfff71dcb02'
AND (
token = 'XKV6hXsJz0F2YQEdJ6XZSzseVFEfQo4qikc688y3PR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)