UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BMuZasH4yaMZS5ulYS3oTu8o8EkvatV8MDHJz+0YRwM='
WHERE
key_id = 'a0b43fe96030903642148bc6f471e8e81c630f237d23d2d1404700915c082c6e'
AND (
token = 'BMuZasH4yaMZS5ulYS3oTu8o8EkvatV8MDHJz+0YRwM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)