UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5aOY6msqkqnZ8H6hgBW63L0DexCq8xJ57kLFXfUWCEA='
WHERE
key_id = 'cbf2b656a5f15145fce0e629c557302efb8b50f2730256cd863762e067047495'
AND (
token = '5aOY6msqkqnZ8H6hgBW63L0DexCq8xJ57kLFXfUWCEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)