UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJgGmydz7rDX0gzlw9vEUhQKMSsbsc6ZBiu4WBq2pU8='
WHERE
key_id = '8d224e9687d7f0cf65c9f649bc2e886c19a0fefc17c1d5b7bf4e927f6f4f40a4'
AND (
token = 'bJgGmydz7rDX0gzlw9vEUhQKMSsbsc6ZBiu4WBq2pU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)