UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bmKtpzDBd7irhq2gnuyLF9l9fJGuhh8Z642hh5UbVCs='
WHERE
key_id = '74e8bfc37a51cc6accf4de3b93e53f55b0d752eb055b0da06c39a127f9eed013'
AND (
token = 'bmKtpzDBd7irhq2gnuyLF9l9fJGuhh8Z642hh5UbVCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)