UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dAw92rcBHBHkBl3B0xau+8rwyiZ+N8xpqeOL9MEc+84='
WHERE
key_id = '98f08ef3892936022d6bf62a8d1a9334520e850d4f2c54bec538da4111887b5d'
AND (
token = 'dAw92rcBHBHkBl3B0xau+8rwyiZ+N8xpqeOL9MEc+84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)