UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aC8G3hmuqIZHmMO8vKQCcJ6b707gM4XCvQNcY33qh80='
WHERE
key_id = '4b947703679c45f41c432d4db0f3bb662bab345d8a791240e93ffdc6c0d73064'
AND (
token = 'aC8G3hmuqIZHmMO8vKQCcJ6b707gM4XCvQNcY33qh80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)