UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dVYlKqeZS9HGly40uPngeyiQZ7dxae8BEcbc6X/z11I='
WHERE
key_id = 'adda1745336d873f652b29b1bb8bc63dc71418c024856f70706b52aeb4ff4934'
AND (
token = 'dVYlKqeZS9HGly40uPngeyiQZ7dxae8BEcbc6X/z11I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)