UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qUPjCOgoNnJgW8TzUK6mHpwrk3zjj7au0AT91UUqo64='
WHERE
key_id = '638d0931f489af10f8a7d77d0e100de7e80c14d5f7a0541f446bcd742b662018'
AND (
token = 'qUPjCOgoNnJgW8TzUK6mHpwrk3zjj7au0AT91UUqo64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)