UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IpdALblrmysJ3xxqmXN2qVQSJ7zW4hroUkxq9W3csaE='
WHERE
key_id = '51a0f42c770db3abbd500a8dd4589ebfdfb0e355ed38a33204d944f46c31c186'
AND (
token = 'IpdALblrmysJ3xxqmXN2qVQSJ7zW4hroUkxq9W3csaE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)